var xmlHttp;
function createXMLHttpRequest(){
	if (window.ActiveXObject) {
		try{
			xmlHttp = new ActiveXObject("Msxm12.XMLHTTP");
		}catch(e){
			try{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(e2){
				xmlHttp = null;
			}
		}
	} else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();
	}else{
		xmlHttp = null;
	}
}

function UTF8_zhTW_To_zhCN(strSFieldID, strDFieldID){
	var strDocLoc = "/k_admin/ChangeCharCode.php?ChType=u8tw-u8cn&Word="+encodeURI(document.getElementById(strSFieldID).value);

	createXMLHttpRequest();
	xmlHttp.onreadystatechange = function(){ CCharet_StateChange(strDFieldID) };
	xmlHttp.open("GET", strDocLoc, true);
	xmlHttp.send(null);
}

function UTF8_zhCN_To_zhTW(strSFieldID, strDFieldID){
	var strDocLoc = "/k_admin/ChangeCharCode.php?ChType=u8cn-u8tw&Word="+encodeURI(document.getElementById(strSFieldID).value);

	createXMLHttpRequest();
	xmlHttp.onreadystatechange = function(){ CCharet_StateChange(strDFieldID) };
	xmlHttp.open("GET", strDocLoc, true);
	xmlHttp.send(null);
}

function CCharet_StateChange(strFieldID){
	if(xmlHttp.readyState == 4){
		if(xmlHttp.status == 200){
			var xmlDoc = xmlHttp.responseXML;
			//var strErrTitle = xmlDoc.getElementsByTagName("ErrTitle")[0].childNodes[0].nodeValue;

			var strErrCon = xmlDoc.getElementsByTagName("ErrContent")[0].childNodes[0].nodeValue;
			document.getElementById(strFieldID).value = strErrCon;
			return;
		}
	}
}